import { ZTool } from "./Framework/Utils/ZTool";

const { ccclass, property } = cc._decorator;

@ccclass
export default class GrenadeListener extends cc.Component {

    nds: cc.Node[] = [];

    protected update(dt: number): void {
        this.node.setPosition(cc.Vec2.ZERO);
    }

    onBeginContact(contact, selfCollider, otherCollider: cc.Collider) {
        console.error(otherCollider.name);
        if (otherCollider.node.group == "Player") {
            this.nds.push(otherCollider.node);
        }
    }

    onEndContact(contact, selfCollider, otherCollider) {
        if (otherCollider.node.group == "Player") {
            ZTool.RemoveItemFromArray(this.nds, otherCollider.node);
        }
    }

}